# -*- coding: utf-8 -*-
from configparser import ConfigParser
import os


class Status:
    def __init__(self):
        self.res = {}
        self.load_config()

    def load_config(self):
        cfgName = 'config/status.cfg'
        if os.path.exists(cfgName):
            config_parser = ConfigParser()
            config_parser.read(cfgName, encoding='utf8')
            cfgs = config_parser.sections()
            for c in cfgs:
                config = config_parser[c]
                rr = {}
                for cfg in config:
                    rr[cfg] = config[cfg]
                    self.res[c] = rr
            # print(self.res)

    # 获取状态
    def get_status(self, name, status):
        return self.res[name][status]
